package com.dyz.leetcode._03_mathematics;

public class _168_convertToTitle {
    //26进制的转换 注意，本题从1开始计，需要减1；
    public String convertToTitle(int columnNumber) {
        StringBuilder sb = new StringBuilder();
        while(columnNumber>0){
            columnNumber--;
            sb.append((char)(columnNumber%26 + 'A'));
            columnNumber /=26;
        }
        return sb.reverse().toString();
    }

    public static void main(String[] args) {
        new _168_convertToTitle().convertToTitle(2147483647);
    }
}
